package com.hnxxxy.jfmgr.controller;

import com.github.pagehelper.PageHelper;
import com.hnxxxy.common.annotation.LogAnno;
import com.hnxxxy.common.tools.Help;
import com.hnxxxy.common.tools.TableObj;
import com.hnxxxy.jfmgr.pojo.Jf_detail;
import com.hnxxxy.jfmgr.service.JfUserTestimonialsStatusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/jf")
@RestController
@Slf4j
public class JfUserTestimonialsController {

    @Autowired
    JfUserTestimonialsStatusService jfUserTestimonialsStatusService;

    @RequestMapping("/f/userTestimonials")
    @LogAnno(description = "获得奖的奖项")
    public TableObj findAlUserTestimonials(TableObj tableObj, Jf_detail jf_detail){
        if (jf_detail.getCertificateName() == ""){
            jf_detail.setCertificateName(null);
        }
        if (jf_detail.getEndTime() == ""){
            jf_detail.setEndTime(null);
        }

        jf_detail.setStatus(4);

        PageHelper.startPage(tableObj.getCurr(), tableObj.getNums());
        List<Jf_detail> list = jfUserTestimonialsStatusService.findAlUserTestimonialsStatus(jf_detail);

        JfUserTestimonialsStatusController j  = new JfUserTestimonialsStatusController();
        list = j.GetPhoto(list);
        return Help.getPageTableRtn(tableObj,list);
    }

}
